package cj.primariaiquest.integration.endpoints;

import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.Router;

import cj.primariaiquest.model.Ticket;
import static cj.primariaiquest.commons.Constants.CHANNEL_SUFIX;

/**
 * Router used to send each ticket to it's corresponding department router.
 * 
 * @author georgian.parvu
 * 
 */
@MessageEndpoint
public class TicketRouter {

    @Router(inputChannel = "requestChannel")
    public String sendTicketToDepartment(final Ticket ticket) {
	String outputChannel = ticket.getDepartment() + CHANNEL_SUFIX;
	return outputChannel;
    }
}
